//
//  PPNetConst.h
//  PPNetworking
//
//  Created by 邓标祥 on 2020/12/15.
//

#ifndef PPNetConst_h
#define PPNetConst_h

@class PPNetBatchRequest, PPNetError, PPNetBatchResult;

/**
 请求类型
 */
typedef NS_ENUM(NSInteger, PPNetRequestType) {
    PPNetRequest_normal    = 0,    //!< 常规http
    PPNetRequest_upload    = 1,    //!< 上传
    PPNetRequest_download  = 2,    //!< 下载
};

/**
 HTTP类型
 */
typedef NS_ENUM(NSInteger, PPNetHTTPMethodType) {
    PPNetHTTPMethod_GET    = 0,    //!< GET
    PPNetHTTPMethod_POST   = 1,    //!< POST
    PPNetHTTPMethod_HEAD   = 2,    //!< HEAD
    PPNetHTTPMethod_DELETE = 3,    //!< DELETE
    PPNetHTTPMethod_PUT    = 4,    //!< PUT
    PPNetHTTPMethod_PATCH  = 5,    //!< PATCH
};

/**
 请求的序列化类型
 */
typedef NS_ENUM(NSInteger, PPNetRequestSerializerType) {
    PPNetRequestSerializer_raw     = 0,    //!<
    PPNetRequestSerializer_json    = 1,    //!<
    PPNetRequestSerializer_plist   = 2,    //!<
};

/**
 响应的序列化类型
 */
typedef NS_ENUM(NSInteger, PPNetResponseSerializerType) {
    PPNetResponseSerializer_raw    = 0,    //!<
    PPNetResponseSerializer_json   = 1,    //!<
    PPNetResponseSerializer_plist  = 2,    //!<
    PPNetResponseSerializer_xml    = 3,    //!<
};


typedef void (^PPNetBatchRequestConfigBlock)(PPNetBatchRequest * _Nonnull batchRequest);


typedef void (^PPNetProgressBlock)(NSProgress * _Nullable progress);
typedef void (^PPNetSuccessBlock)(id _Nonnull responseObject);
typedef void (^PPNetFailureBlock)(PPNetError * _Nonnull ppError);
typedef void (^PPNetFinishedBlock)(id _Nullable responseObject, NSError * _Nullable error);

typedef void (^PPBCFinishedBlock)(PPNetBatchResult * _Nonnull result);

typedef void (^PPNetJsonResultBlock)(id _Nullable resultObject, PPNetError * _Nullable resultError);

#endif /* PPNetConst_h */
